﻿using System;
using System.Collections.Generic;
using System.Data;
using PSE.Deployment.ConfigurationManager.Controls;
using PSE.Deployment.SetupBase.Parameter;
using PSE.Deployment.SetupBase.Parameter.Enums;
using PSEComponents.Deployment.ConfigurationManager.Controls.AuditLoggingServiceControl;

namespace PSEComponents.Deployment.ConfigurationManager.UI
{
    public partial class MainWindow : PSE.Deployment.ConfigurationManager.UI.WindowBase
    {
        private const string CONTINGENCY_LOGGING_SERVICE_NAME = "BM&FBOVESPA Audit Logging Contingency Service";
        private const string STORAGE_LOGGING_SERVICE_NAME = "BM&FBOVESPA Audit Logging Storage Service";

        public MainWindow()
        {
            this.WindowTitle = "Configurador dos componentes da plataforma de serviços";
        }

        protected override string SystemId
        {
            get { return "PSEComponents-v3"; }
        }

        protected override PSE.Deployment.ConfigurationManager.Controls.ServiceControl CreateServiceControl(PSE.Deployment.SetupBase.Configuration.WindowsService windowsService)
        {
            switch (windowsService.ServiceName)
            {
                case STORAGE_LOGGING_SERVICE_NAME:
                    return new StorageServiceControl(windowsService);
                case CONTINGENCY_LOGGING_SERVICE_NAME:
                    return new ContingencyServiceControl(windowsService);
                default:
                    return new ServiceControl(windowsService);
            }
        }
    }
}
